<?php
declare (strict_types = 1);

namespace app\shop\controller;

use app\BaseShopController;
use app\common\service\UserService\MemberFeedbackService;
use app\Normal;
use think\annotation\Route;
use think\annotation\route\Group;
use think\annotation\route\Middleware;

/**
 * @Group("feedback")
 * @Middleware({shopMiddileware::class})
 */
class MemberFeedback extends BaseShopController {
    /**
     * 获取数据表分页
     * @Route("index",method="GET")
     * @return string
     */
    public function index() {
        $result = callApi(MemberFeedbackService::class, 'index', $this->_all_data);
        return apiResponse($result);
    }

    /**
     * 处理反馈
     * @Route("setStatus",method="put")
     * @return string
     */
    public function setStatus() {
        $result = callApi(MemberFeedbackService::class, 'handleStatus', $this->_all_data);
        if ($result['code'] == Normal::SUC) {
            $this->log(['content' => '处理用户反馈', 'request_param' => json_encode($this->_all_data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]);
        }
        return apiResponse($result);
    }
}